package com.tr.state;

/**
 * @author TRasdzz
 * @since 2021/3/10 17:07
 * @version 1.0
 */
//测试Join方法  想象位插队
public class TestJoin implements Runnable {

    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println("线程vip来了" + i);
        }
    }

    public static void main(String[] args) throws InterruptedException {

        //启动我们的线程
        TestJoin testJoin = new TestJoin();
        Thread thread = new Thread(testJoin);
        thread.start();

        //主线程
        for (int i = 0; i < 500; i++) {
            if (i == 200) {
                thread.join();
            }
            System.out.println("main" + i);
        }
    }
}
//main197
//main198
//main199
//线程vip来了236
//线程vip来了237
//线程vip来了238
//     .
//     .
//     .
//线程vip来了997
//线程vip来了998
//线程vip来了999
//main200
//main201
//main202